package com.my.project.eurekaconsumer.service;

import com.my.project.eurekaconsumer.component.HiSendImplService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Author: lsg
 * @Date: Created 2018-07-25 11:27
 */
//通过@ FeignClient（name="服务名"），来指定调用哪个服务。比如在代码中调用了eureka-client服务的“/user/hello”接口，
// 还可以使用url参数指定一个URL  fallback  出现错误回调类
@FeignClient(name = "eureka-client", fallback = HiSendImplService.class)
public interface IHiSendService {

    @RequestMapping(value = "/hi", method = RequestMethod.GET)
    String sayHiFromClientOne(@RequestParam(value = "name") String name); //添加参数name 相当于/hi?name=xxx
}
